﻿function ChangeBanner(arrBanner, arIdx, strLnk, strImg)
{	
	if (arrBanner.length==0)
		return;
	
	arIdx[0]++;
	
	if (arIdx[0] >= arrBanner.length)
	{
		arIdx[0]=0;
	}
	document.links[arIdx[1]].href= arrBanner[arIdx[0]][1];
	document.images[strImg].src = arrBanner[arIdx[0]][0];
	document.images[strImg].width = arrBanner[arIdx[0]][2];
}
function DisplayBanner(strAr, arBanner, strIdx, arIdx, strLnk, strImg,strClickTarget, strPlaceHolderID)
{	
	arIdx[0] = Math.floor(Math.random()*arBanner.length);
	arIdx[1] = document.links.length;
		
	if (document.getElementById) {
		var adTable = document.createElement('table');
		adTable.setAttribute('cellpadding', '0');
		adTable.setAttribute('cellspacing', '0');
		adTable.setAttribute('border', '0');
		adTable.setAttribute('width', '100%');
		
		var adTableBody = document.createElement('tbody');		
		
		var adRow = document.createElement('tr');
		
		var adCell = document.createElement('td');
		adCell.setAttribute('align', 'center');
		adCell.setAttribute('class', 'ShowAdv_Cell');
		
		var adLink = document.createElement('a');
		adLink.setAttribute('name', strLnk);
		adLink.setAttribute('id', strLnk);
		adLink.setAttribute('href', arBanner[arIdx[0]][1]);
		adLink.setAttribute('target', strClickTarget);
		
		var adImage = document.createElement('img');
		adImage.setAttribute('name', strImg);
		adImage.setAttribute('id', strImg);
		adImage.setAttribute('src', arBanner[arIdx[0]][0]);
		adImage.setAttribute('width', arBanner[arIdx[0]][2]);
		adImage.setAttribute('border', 0);
		
		adLink.appendChild(adImage);
		adCell.appendChild(adLink);
		adRow.appendChild(adCell);
		adTableBody.appendChild(adRow);
		adTable.appendChild(adTableBody);
		
		var PlaceHolder = document.getElementById(strPlaceHolderID);
		
		PlaceHolder.appendChild(adTable);
	}
	
	//setInterval('ChangeBanner('+strAr+','+strIdx+', \''+strLnk+'\', \''+strImg+'\')', 7000);
}